package com.bw.contorller;

import com.alibaba.fastjson.JSONObject;
import com.bw.service.TrafficServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("/traffic")
public class TrafficContorller {
    @Autowired
    TrafficServiceImpl service;
    @RequestMapping("/Trafficvccharis_newshoppageviewwindow")
    public List<JSONObject> Trafficvccharis_newshoppageviewwindow(@RequestParam( defaultValue = "99999")String dt)
    {
        if("99999".equals(dt)){
            Date date = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");

            int f = Integer.parseInt(dateFormat.format(date));
            List<JSONObject> jsonObjects = service.Trafficvccharis_newshoppageviewwindow(dt);
            System.out.println(jsonObjects);
            return jsonObjects;
        }else {
            List<JSONObject> jsonObjects = service.Trafficvccharis_newshoppageviewwindow(dt);
            System.out.println(jsonObjects);
            return jsonObjects;
        }
    }

}
